package com.example.demo.Dao;

import com.example.demo.Model.Student;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface StudentDao {
    @Select("select*from student")
    public List<Student> findAll();

    @Select("select*from student where stuID=#{stuID}")
    public Student findByStuID(String stuID);

    @Insert("insert into student(stuID,name,stuclass,useremail) values(#{stuID},#{name},#{stuclass},#{useremail})")
    public void save(Student stu);

    @Update("update student set stuID=#{stuID},name=#{name},stuclass=#{stuclass},useremail=#{useremail}")
    public void update(Student stu);

    @Update("update student set useremail=#{useremail} where stuID=#{stuID}")
    public void update_email(String useremail,@Param("stuID")String stuID);
}
